<!DOCTYPE html>
<html>
	<head>
		<meta charset="UTF-8">
		<title></title>
	</head>
	<body>
		<div>
			<input class="num" type="text" />
			<button class="btn">计算</button>
			<div class="result"></div>
			<div class="count"></div>
		</div>
	</body>
	<script type="text/javascript" src="jquery-2.1.0.js"></script>
	<script type="text/javascript">
		$(".btn").click(function(){
			
			var n = 0;
			var timer = setInterval(function(){
				n++
				$(".count").text(n)
			},100)
			
			var val = $(".num").val();
			$(".result").text(computed(val))
						
			function computed(val){
				return val < 2 ? val : computed(val-1) + computed(val-2)
			}
			
		})
		
	</script>
</html>
